<template>
  <div id="algo-main">
    <main-search ref="mainsearch" :key="$route.fullPath" @model='algonewmodel'/>
    <main-exhibition :hardware='algohardware' :model='algomodel' :scene='algoscene' :shop='algoshop'/>
    <tabs-context :shows='show' ref="algotabs" :url="backAlgo"/>
  </div>
</template>
<script>
import TabsContext from '../../components/common/tabscontext/TabsContext.vue'
import MainExhibition from '../../components/content/exhibition/MainExhibition.vue'
import MainSearch from '../../components/content/search/MainSearch.vue'
import {getAlgoAllData} from 'api/algorithm.js'
export default {
  name:'AlgoMain',
  data(){
    return {
      path:'',
      show:[],
      backAlgo:'/algorithm/detail/',
      algohardware:['CPU','GPU','Intel Mov','Nvidia Jetson Nano','Google Coral','Nvidia Jetson TX2'],
      algomodel:['自然语言','机器学习','强化学习','通用AI','元学习','其他'],
      algoscene:['智慧工业','智慧教育','智慧农业','智慧硬件','智慧服务','其他'],
      algoshop:['官方自营','企业店铺','个人店铺'],
    }
  },
  components:{
    MainSearch,
    MainExhibition,
    TabsContext
  },
  created(){
    this.AllData();
  },
  mounted(){
    this.$refs.mainsearch.placeholder='深度学习模型';
    this.$refs.mainsearch.searchtype='algo';
  },
  methods:{
    AllData(){
       getAlgoAllData('/api/model/listAllModels').then(res=>{
    this.$refs.algotabs.label1='最新发布';
    this.$refs.algotabs.label2='最多点赞';
    this.$refs.algotabs.label3='最多浏览';
         this.show=res.data;
       }).catch(err=>{
        this.$Notice.error({
        title:'请求失败',
        duration:5})
       });
    },
    algonewmodel(data){
      this.show=data;
    }
  }
}
</script>